import 'dart:ui';

import 'package:flutter/material.dart';

class MYSizeFit {
//  final  mediaQueryData = MediaQuery(data: null, child: null);

  // 基本信息
  static double physicalWidth;
  static double physicalHeight;
  static double screenWidth;
  static double screenHeight;
  static double dpr;
  static double statusHeight;


  static double rpx;
  static double px;

  static void initialize({double standardSize = 750}) {
    // 手机的物理分辨率
    physicalHeight = window.physicalSize.height;
    physicalWidth = window.physicalSize.width;

    // 获取dpr
    dpr = window.devicePixelRatio;

    // 宽度和高度
    screenHeight = physicalHeight / dpr;
    screenWidth = physicalWidth / dpr;

    // 状态栏高度
    statusHeight = window.padding.top / dpr;

    // 计算rpx的大小
    rpx = screenWidth / standardSize;
    px = (screenWidth / standardSize) * 2;


  }

  static double setRpx(double size) {
    return rpx * (size);
  }

  static double setPx(double size) {
    return px * (size);
  }

}